Skip to main content

SHOW-DATABASES

SHOW-DATABASES

Name

SHOW DATABASES

Description

This statement is used to display the currently visible db

Syntax:

SHOW DATABASES [FROM catalog] [filter expr];

Note:

  1. SHOW DATABASES will display all database names
  2. SHOW DATABASES FROM catalog will display all database names from the current catalog.
  3. SHOW DATABASES filter_expr will display filtered database names from the current catalog.
  4. SHOW DATABASES FROM catalog filter_expr is not support yet.

Example

  1. Display all the database names

    SHOW DATABASES;
     +--------------------+
    | Database |
    +--------------------+
    | test |
    | information_schema |
    +--------------------+
  2. Display all database names from the catalog named 'hms_catalog'.

    SHOW DATABASES from hms_catalog;
     +---------------+
    | Database |
    +---------------+
    | default |
    | tpch |
    +---------------+
  3. Display the filtered database names from the current catalog using the expression like 'infor%'.

    SHOW DATABASES like 'infor%';
     +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    +--------------------+

Keywords

SHOW, DATABASES

Best Practice